当前位置: 首页>>代码示例>>Java>>正文


Java ParsingException类代码示例

本文整理汇总了Java中nu.xom.ParsingException的典型用法代码示例。如果您正苦于以下问题:Java ParsingException类的具体用法?Java ParsingException怎么用?Java ParsingException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParsingException类属于nu.xom包,在下文中一共展示了ParsingException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import nu.xom.ParsingException; //导入依赖的package包/类
@Test
public void update()
    throws ValidityException, ParsingException, IOException, MojoExecutionException {
  Document pom = new Builder().build(new File(new File("src/it/reflector"), "pom.xml"));
  Artifact artifact = new DefaultArtifact(
      "net.stickycode",
      "sticky-coercion",
      "jar",
      "",
      "[3.1,4)");

  new StickyBoundsMojo().updateDependency(pom, artifact, "[3.6,4)");
  XPathContext context = new XPathContext("mvn", "http://maven.apache.org/POM/4.0.0");

  Nodes versions = pom.query("//mvn:version", context);
  assertThat(versions.size()).isEqualTo(3);
  Nodes nodes = pom.query("//mvn:version[text()='[3.6,4)']", context);
  assertThat(nodes.size()).isEqualTo(1);
  Node node = nodes.get(0);
  assertThat(node.getValue()).isEqualTo("[3.6,4)");
}
 
开发者ID:stickycode,项目名称:bounds-maven-plugin,代码行数:22,代码来源:StickyBoundsMojoIntegrationTest.java

示例2: updateWithClassifier

import nu.xom.ParsingException; //导入依赖的package包/类
@Test
public void updateWithClassifier()
    throws ValidityException, ParsingException, IOException, MojoExecutionException {
  Document pom = new Builder().build(new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("classifiers.xml"))));
  Artifact artifact = new DefaultArtifact(
      "net.stickycode",
      "sticky-coercion",
      "jar",
      "",
      "[2.1,4)");
  
  new StickyBoundsMojo().updateDependency(pom, artifact, "[2.6,3)");
  XPathContext context = new XPathContext("mvn", "http://maven.apache.org/POM/4.0.0");
  
  Nodes versions = pom.query("//mvn:version", context);
  assertThat(versions.size()).isEqualTo(4);
  Nodes nodes = pom.query("//mvn:version[text()='[2.6,3)']", context);
  assertThat(nodes.size()).isEqualTo(1);
  Node node = nodes.get(0);
  assertThat(node.getValue()).isEqualTo("[2.6,3)");
}
 
开发者ID:stickycode,项目名称:bounds-maven-plugin,代码行数:22,代码来源:StickyBoundsMojoIntegrationTest.java

示例3: shouldNotModifyDocumentWhenAllXPathsTraversable

import nu.xom.ParsingException; //导入依赖的package包/类
@Test
public void shouldNotModifyDocumentWhenAllXPathsTraversable()
        throws XPathExpressionException, ParsingException, IOException {
    Map<String, Object> xmlProperties = fixtureAccessor.getXmlProperties();
    String xml = fixtureAccessor.getPutValueXml();
    Document oldDocument = stringToXml(xml);
    Document builtDocument = new XmlBuilder(namespaceContext)
            .putAll(xmlProperties)
            .build(oldDocument);

    assertThat(xmlToString(builtDocument)).isEqualTo(xml);

    builtDocument = new XmlBuilder(namespaceContext)
            .putAll(xmlProperties.keySet())
            .build(oldDocument);

    assertThat(xmlToString(builtDocument)).isEqualTo(xml);
}
 
开发者ID:SimY4,项目名称:xpath-to-xml,代码行数:19,代码来源:XmlBuilderTest.java

示例4: loadXmlDefinition

import nu.xom.ParsingException; //导入依赖的package包/类
/**
 * Use the CacheXmlGenerator to create XML from the entity associated with
 * the current cache.
 * 
 * @param element Name of the XML element to search for.
 * @param attributes
 *          Attributes of the element that should match, for example "name" or
 *          "id" and the value they should equal.
 * 
 * @return XML string representation of the entity.
 */
private final String loadXmlDefinition(final String element, final Map<String, String> attributes) {
  final Cache cache = CacheFactory.getAnyInstance();
  Document document = null;

  try {
    final StringWriter stringWriter = new StringWriter();
    final PrintWriter printWriter = new PrintWriter(stringWriter);
    CacheXmlGenerator.generate(cache, printWriter, false, false, false);
    printWriter.close();

    // Remove the DOCTYPE line when getting the string to prevent
    // errors when trying to locate the DTD.
    String xml = stringWriter.toString().replaceFirst("<!DOCTYPE.*>", "");
    document = new Builder(false).build(xml, null);

  } catch (ValidityException vex) {
    cache.getLogger().error("Could not parse XML when creating XMLEntity", vex);

  } catch (ParsingException pex) {
    cache.getLogger().error("Could not parse XML when creating XMLEntity", pex);
    
  } catch (IOException ioex) {
    cache.getLogger().error("Could not parse XML when creating XMLEntity", ioex);
  }
  
  Nodes nodes = document.query(createQueryString(element, attributes));
  if (nodes.size() != 0) {
    return nodes.get(0).toXML();
  }
  
  cache.getLogger().warning("No XML definition could be found with name=" + element + " and attributes=" + attributes);
  return null;
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:45,代码来源:XmlEntity.java

示例5: Mei4Gui

import nu.xom.ParsingException; //导入依赖的package包/类
/**
 * constructor
 * @param file
 * @param app
 */
public Mei4Gui(File file, MeicoApp app) throws InvalidFileTypeException, IOException, ParsingException, UnsupportedAudioFileException {
    this.msm = new ArrayList<>();

    if (file.getName().substring(file.getName().lastIndexOf(".")).toLowerCase().equals(".mei")) {           // if it is an mei file
        this.readMeiFile(file, false);                                                  // load it
    }
    else {                                                                              // otherwise try loading it as an msm (or midi) object
        this.msm.add(new Msm4Gui(file, app));                                                // load it into the msms list
    }

    this.panel = new JPanel();                                                          // initialize the gui component
    this.app = app;                                                                     // store the reference to the meico app
    this.idsAdded = false;
    this.copyofsResolved = false;
    this.expansionsResolved = false;
    this.ppq = 720;
}
 
开发者ID:cemfi,项目名称:meico,代码行数:23,代码来源:MeicoApp.java

示例6: createReader

import nu.xom.ParsingException; //导入依赖的package包/类
public HierarchicalStreamReader createReader(File paramFile)
{
  try
  {
    XomReader localXomReader = new XomReader(this.builder.build(paramFile), getNameCoder());
    return localXomReader;
  }
  catch (ValidityException localValidityException)
  {
    throw new StreamException(localValidityException);
  }
  catch (ParsingException localParsingException)
  {
    throw new StreamException(localParsingException);
  }
  catch (IOException localIOException)
  {
    throw new StreamException(localIOException);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:21,代码来源:XomDriver.java

示例7: updateTheClassifier

import nu.xom.ParsingException; //导入依赖的package包/类
@Test
public void updateTheClassifier()
    throws ValidityException, ParsingException, IOException, MojoExecutionException {
  Document pom = new Builder().build(new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("classifiers.xml"))));
  Artifact artifact = new DefaultArtifact(
      "net.stickycode",
      "sticky-coercion",
      "jar",
      "test-jar",
      "[2.1,4)");

  new StickyBoundsMojo().updateDependency(pom, artifact, "[2.6,3)");
  XPathContext context = new XPathContext("mvn", "http://maven.apache.org/POM/4.0.0");

  Nodes versions = pom.query("//mvn:version", context);
  assertThat(versions.size()).isEqualTo(4);
  Nodes nodes = pom.query("//mvn:version[text()='[2.6,3)']", context);
  assertThat(nodes.size()).isEqualTo(1);
  Node node = nodes.get(0);
  assertThat(node.getValue()).isEqualTo("[2.6,3)");
}
 
开发者ID:stickycode,项目名称:bounds-maven-plugin,代码行数:22,代码来源:StickyBoundsMojoIntegrationTest.java

示例8: readBrick

import nu.xom.ParsingException; //导入依赖的package包/类
private static GeometryWithMaterial readBrick(Element partElement, LIFReader dbLifReader, HashMap<Integer, Material> materials) throws IOException, ValidityException, ParsingException {
	int partID = Integer.parseInt(partElement.getAttributeValue("designID"));
	String materialName = partElement.getAttributeValue("materials");
	//no support for multiple materials.
	if(materialName.indexOf(',') != -1) {
		String[] parts = materialName.split(",");
		materialName = parts[0];
	}
	
	int materialID = Integer.parseInt(materialName);
	Material material = materials.get(materialID);
	
	VBOContents combo = BrickReader.readBrick(dbLifReader, partID);
	Elements boneElements = partElement.getChildElements("Bone");
	//Single bone element = non-flex brick
	if(boneElements.size() == 1) {
		String transformationString = boneElements.get(0).getAttributeValue("transformation");
		Matrix4f transformation = Bone.readBrickTransformation(transformationString);
		combo = combo.transform(transformation);
	} else {
		combo = FlexElement.transform(combo, boneElements, partID, dbLifReader);
	}
	return new GeometryWithMaterial(combo, material);
}
 
开发者ID:chipgw,项目名称:LibLDD,代码行数:25,代码来源:LXFMLReader.java

示例9: SettingsManager

import nu.xom.ParsingException; //导入依赖的package包/类
/**
 * Constructs the class. Requires settings.xml to be present to run
 */
public SettingsManager() {
    String currentDir = System.getProperty("user.dir");
    String settingDir = currentDir + "/settings/";
    File f = new File(settingDir + "settings.xml");
    if (f.exists() && !f.isDirectory()) {
        try {
            Builder parser = new Builder();
            Document doc   = parser.build(f);
            Element root   = doc.getRootElement();

            Element eUsername = root.getFirstChildElement("Username");
            username = eUsername.getValue();

            Element ePassword = root.getFirstChildElement("Password");
            password = ePassword.getValue();

            requiresAuth = true;
        } catch (ParsingException|IOException e) {
            e.printStackTrace();
        }
    }
    else {
        requiresAuth = false;
    }
}
 
开发者ID:ajohnston9,项目名称:ciscorouter,代码行数:29,代码来源:SettingsManager.java

示例10: getDocument

import nu.xom.ParsingException; //导入依赖的package包/类
/**
 * @param path the path of the requested document
 * @return the document that lives under the given path in the ZIP fs.
 * @throws IOException in case of any failure
 */
public Document getDocument(String path) throws IOException {
	Builder builder = new Builder();
	try {
		byte[] documentData = content.get(path);
		if (documentData == null) {
			throw new IOException(
				Messages.getString(
						"ZipFs.invalidDocument",//$NON-NLS-1$
						path)); 
		}
		return builder.build(new ByteArrayInputStream(content.get(path)));
	} catch (ParsingException e) {
		throw new IOException(e);
	}		
}
 
开发者ID:ADHO,项目名称:dhconvalidator,代码行数:21,代码来源:ZipFs.java

示例11: makePublicationStmt

import nu.xom.ParsingException; //导入依赖的package包/类
/**
 * Make a &lt;publicationStmt&gt;
 * @param document
 * @throws IOException
 */
private void makePublicationStmt(Document document) throws IOException {
	
	Element publicationStmtElement = DocumentUtil.getFirstMatch(
			document, 
			"/tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt",  //$NON-NLS-1$
			xPathContext);
	
	publicationStmtElement.removeChildren();
	try {
		Document publicationStmtDoc = 
			new Builder().build(
				PropertyKey.publicationStmt.getValue(), TeiNamespace.TEI.toUri());
		publicationStmtElement.getParent().replaceChild(
				publicationStmtElement, publicationStmtDoc.getRootElement().copy());
	}
	catch (ParsingException pe) {
		throw new IOException(pe);
	}
}
 
开发者ID:ADHO,项目名称:dhconvalidator,代码行数:25,代码来源:CommonOutputConverter.java

示例12: getInputDataTypes

import nu.xom.ParsingException; //导入依赖的package包/类
/**
 * @return available input data types as offered by OxGarage
 * @throws IOException in case of any failure
 */
Document getInputDataTypes() throws IOException {
	String uri = baseURL + CONVERSION_OPERATION;
	ClientResource client = new ClientResource(Context.getCurrent(), Method.GET, uri);

	Representation result = client.get();
	Builder builder = new Builder();
	try {
		Document inputDataTypes = builder.build(result.getStream());
		
		return inputDataTypes;
	}
	catch (ParsingException e) {
		throw new IOException(e);
	}
}
 
开发者ID:ADHO,项目名称:dhconvalidator,代码行数:20,代码来源:OxGarageConversionClient.java

示例13: main

import nu.xom.ParsingException; //导入依赖的package包/类
public static void main(String[] args) throws IOException, ParsingException
{
   if (args.length <= 2) {
      System.out.println("Usage: <pages.xml file> <givennames out> <surnames out>");
   }
   else {
      RelatedNamesExtractor extractor = new RelatedNamesExtractor(args[1], args[2]);
      WikiReader wikiReader = new WikiReader();
      wikiReader.setSkipRedirects(true);
      wikiReader.addWikiPageParser(extractor);
      InputStream in = new FileInputStream(args[0]);
      wikiReader.read(in);
      in.close();
      extractor.close();
   }
}
 
开发者ID:werelate,项目名称:wikidata,代码行数:17,代码来源:RelatedNamesExtractor.java

示例14: parse

import nu.xom.ParsingException; //导入依赖的package包/类
public void parse(String title, String text, int pageId, int latestRevId, String username, String timestamp, String comment) throws IOException, ParsingException {
   if(title.startsWith(currentPagePrefix)) {
      String[] split = splitStructuredWikiText(currentPagePrefix.toLowerCase().substring(0,currentPagePrefix.indexOf(':')), text);
      title = title.substring(currentPagePrefix.length());
      String structuredData = split[0];
      String wikiText = split[1];
      if (!Util.isEmpty(structuredData)) {
         Document doc = parseText(split[0]);
         Element elm = doc.getRootElement();

         Elements prevParents = elm.getChildElements("related");
         for (int i = 0; i < prevParents.size(); i++) {
            Element prevParent = prevParents.get(i);
            String name = Util.translateHtmlCharacterEntities(prevParent.getAttributeValue("name"));
            if(name != null){//shouldn't happen unless some incorrect xml
               String key = clean(name);
               if(names_Links.containsKey(key)){
                  Set<String> temp = names_Links.get(key);
                  temp.add(title);
               }
            }
         }
      }
      names_Links.remove(clean(title));
   }
}
 
开发者ID:werelate,项目名称:wikidata,代码行数:27,代码来源:CommonNamePagesToCreate.java

示例15: main

import nu.xom.ParsingException; //导入依赖的package包/类
public static void main(String[] args) throws IOException, ParsingException
{
   if (args.length <= 3) {
      System.out.println("Usage: <pages.xml file> <Prefix to do> <output NameFile> <Common Names>");
   }
   else {
      CommonNamePagesToCreate surnames = new CommonNamePagesToCreate();
      surnames.setPrefix(args[1]);
      surnames.loadCommonNames(args[3]);
      WikiReader wikiReader = new WikiReader();
      wikiReader.setSkipRedirects(true);
      wikiReader.addWikiPageParser(surnames);
      InputStream in = new FileInputStream(args[0]);
      wikiReader.read(in);
      in.close();
      surnames.openFile(args[2]);
      surnames.writeFile();
      surnames.close();   
   }
}
 
开发者ID:werelate,项目名称:wikidata,代码行数:21,代码来源:CommonNamePagesToCreate.java


注:本文中的nu.xom.ParsingException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。