jazad136 / bfs-xml Goto Github PK
View Code? Open in Web Editor NEWBreadth First Search Style XML Parser
License: Apache License 2.0
Breadth First Search Style XML Parser
License: Apache License 2.0
The command line parser uses the DOMParseHelper.java file to process W3C XML documents, however, the exceptions thrown by these should be translated into this application's style of exception reporting.
SAXParseException
's could be detailed with line numbers as an added bonus.
Edits to the licensing of files within the project need to be made.
One Piece. After Part 1 is complete, ensure a test of a file can handle the special pickup and printing of the content of "complex" text elements (those containing other elements). Use the shiporder example from w3schools.com.
Two pieces.
This is the main use case of the XMLIterable object.
org.w3c.xml.Document doc;
IterateBFS it = new IterateBFS(doc);
it.startXMLBFS();
while(!it.bfsDone()) {
Definition nextDef = it.bfsv.bfsVisit();
boolean useful = it.continueXMLBFS(nextDef);
if(useful && it.bfsv.parentIsReady())
System.out.println(it.bfsv.readyParent());
}
System.out.println("Done.");
We improved upon this by using this new use case.
XMLIterable xmlIter = new XMLIterable(org.w3c.xml.Document doc)
for(Definition def : xmlIter) {
System.out.println(def);
}
But here we are sorely missing information about whether the next node is the last sibling in the BFS queue. This is unfortunate, as I thought streamlining and reducing the code would make all things nice. We need a middle ground solution.
Step 1: ensure that detecting whether the sibling we're on is the last one, is accessible from XmlIterator (not iterable), so that we can go through our tests presented in issues #1 and #2 easily.
The code in BFS XML can be put to good use:
For an XML file that looks like this?
<cart>
<item>
<name>Bean</name>
<price>2.00</price>
<isCandy>false</isCandy>
</item>
<item>
<name>Jawbreaker</name>
<price>1.00</price>
<isCandy>true</isCandy>
</item>
</cart>
Take this input and read in the last "two layers" of information
where
The first layer is the tags that hold text or attributes
The final layer is the text inside the inner most tags
And create a CSV file that looks like this
...
item , name , price , candy
1, Bean , 2.00 , false
2, Jawbreaker, 1.00 , true
I like this idea. This idea makes sense as a useful way to use the output of the tool.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.