JAXP(DOM) and schema's

Is it possible to process a document with a schema with DOM. I know it is possible with SAX but i was not sure if it was with DOM and i didn't want to get started on something that is not possible. Althought i would expect that i can seeing as schema's are W3C's standard. Thank you.

Hello one & all
I have to parse two xml files (same format but different values) and print the mismatch, if any elementwise..
I am trying to create dom for these two files butafter that not able to traverse the xml file element wise (as it is a complex file, nested elements ).
can any one guide me appropriately how to do this.with steps.
Its urgent.

Similar Messages

  • JAXP parser and schema

    I have a schema which use <xs:include> to include different schema.
    When creating XML DOM parser I handled the schema and it's location
    on the disk.
    When running the XML parser, I handled it XML file which located in the
    same directory in the disk where the 2 schemas located, and it works
    well.
    The problem is when I move the XML file to different directory on the
    disk the parser shouts that it can not find the schema.
    I tried to use URI in the include, but it didn't work as well.
    I will appreciate your help
    Thanks.

    Specify relative path of schema, schemaLocation="/schema.xsd"
    or absolute path of schema, schemaLocation="c:/schema.xsd"

  • Changing /updating an xml file using JAXP(DOM)

    Hello,
    i am fairly new to xml and am using it in my degree project.I am able to retrieve and read data from a fairly large xml file using JAXP(DOM) and/or XMLBeans.I am having difficulties in updating the xml document. Any updation i believe is ito be saved into a new xml document,but dont know how to proceed with it. Any help would be appreciated.
    Following is a snippet of my code using JAXP. Here i am able to retrieve data from the source file.
    File document=new File("C:\\tester.xml");
    try {
    DocumentBuilderFactory factory
    = DocumentBuilderFactory.newInstance();
    DocumentBuilder parserr = factory.newDocumentBuilder();
    Document doc=parserr.parse(document);
    System.out.println(document + " is well-formed.");
    NodeList n2=doc.getElementsByTagName("Top");
    NodeList n3=doc.getElementsByTagName("Base");
    int x=n2.getLength();
    System.out.println("There are " x "players");
    for(int g=0;g<=x;g++)
    System.out.println("Top is" + n2.item(g).getFirstChild().getNodeValue()+" Base is" +n3.item(g).getFirstChild().getNodeValue());
    --------------------------------------------------------------------------------

    Following is my updation code to the dom tree:
    NodeList list=doc.getElementsByTagName("Information");
    for(int i=0; i<list.getLength();i++){
    Node thissampnode=list.item(i);
    Node thisNameNode=thissampnode.getFirstChild();
    if(thisNameNode==null) continue;
    if(thisNameNode.getFirstChild()==null)continue;
    // if(thisNameNode.getFirstChild() !(instanceof org.w3c.dom.Text) continue;
    String data=thisNameNode.getFirstChild().getNodeValue();
    if (! data.equals("0.59")) continue;
    Node newsampNode = doc.createElement("Samp");
    Node newsampTopNode = doc.createElement("Top");
    Text tnNode = doc.createTextNode("0.50");
    newsampTopNode.appendChild(tnNode);
    Element newsampRef = doc.createElement("Ref");
    Text tsr = doc.createTextNode("0");
    newsampRef.appendChild(tsr);
    Element newsampType = doc.createElement("Type");
    Text tt = doc.createTextNode("z");
    newsampType.appendChild(tt);
    Element newsampbase = doc.createElement("Base");
    Text sb = doc.createTextNode("0.55");
    newsampbase.appendChild(sb);
    newsampNode.appendChild(newsampTopNode);
    newsampNode.appendChild(newsampRef);
    newsampNode.appendChild(newsampType);
    newsampNode.appendChild(newsampbase);
    rootNode.insertBefore(newsampNode, thissampnode);
    Here i dont see any changes to the original xml source file.

  • DOM, XML Schema, Java.  Confused!!!

    Hi all,
    Please help me to answer the 3 questions. I'm totally confused.
    1. Does DOM allow us to add invalid data based on the XML schema?
    2. I have an XML file. I want to use DOM to add, modify and delete nodes from the file, then print out an XML output file. If DOM does not prevent us from adding invalid data, I guess we have to run the validation after the output file is printed out?
    3. There are so many parsers, DOM, ... outthere that I am totally confused. Please give me your suggestions. I want to use Java to populate the DOM tree, check the data integrity based on the XML schema as I modify the DOM tree (if possible) or after printing the XML output to a file. What parser should I use? What DOM should I use (DOM or JDOM)? Can I use MS XML parser (because that what my main client uses), DOM, and Java? If so what do I need. I have read 2 books and many sites, but still don't have the answer clear yet.
    Very appreciate your help,
    Nam.

    1.
    never tried with Schema, with DTD: yes
    2.
    it is what I did*, which is pretty clumsy: currently AmauryDebou has started another thread on this subject but there's no answer yet.
    *in fact I do everything in RAM (no file needed): I ouptut the DOM in a byte array and then reparse it
    3.
    Xalan/Xerces is pretty standard (they are used in JAXP).
    JDOM has a reputation of being faster than DOM - depends on the amount of data you deal with.
    if you develop in Java, forget MSXML
    if parsing speed is an issue, you can achieve excellent performances with James Clark's XP.

  • Need XML (JAXP DOM) creating/parsing sample coding

    Where to find some sample code of XML document creating and parsing with JAXP DOM? Thanks.

    Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse("c:/myfile.xml");

  • Difference between DOM and SAX

    Difference between DOM and SAX

    a sax parser is event driven meaning it processes the xml as it sees it and then forgets about it.
    you have to implement what you want the parser to do wants it reaches a certain event
    dom on the other hand keeps the whole structure of the message in memory as a tree.
    so there are strengths and weaknesses in both.
    you have to evaluate what you need

  • Delete elements from XML file using DOM and java

    Hi
    I want now is to remove element from my XML file
    for example
    i have following xml
    <?xml version="1.0" encoding="UTF-8"?>
    <printing>
    <firstLineTexts>
              <firstLineText />
              <firstLineText>|line11</firstLineText>
              <firstLineText>|line12</firstLineText>
    </firstLineTexts>
    </printing>how do i remove all elements fireLineText
    my final output should be
    <?xml version="1.0" encoding="UTF-8"?>
    <printing>
    <firstLineTexts>
    </firstLineTexts>
    </printing>How do i do it using DOM,
    I can create instance of DOM and write it using TransformerFactory
    Ashish

    Hi
    I am trying the following code,
    but it is not working
                    NodeList nScene = doc.getElementsByTagName("firstLineTexts");
              NodeList nScene1 = nScene.item(0).getChildNodes();
              for (int i = 0; i < nScene1.getLength(); i++)
                   Node n = nScene1.item(i);
                        nScene.item(0).removeChild(n);
              }

  • How to define JAXP Parsers and Transformer in a Web Application Context

    Hi
    I need to define JAXP Parsers and Transformer in a Web Application Context where I can deploy this application in any J2EE Application Server without modifying the server. That means that I can't set System properties or set the jaxp.properties file. I tried to use the META-INF/services/javax.xml.transform.TransformerFactory file but it didn't work.
    Any ideas?

    Hi
    I need to define JAXP Parsers and Transformer in a Web Application Context where I can deploy this application in any J2EE Application Server without modifying the server. That means that I can't set System properties or set the jaxp.properties file. I tried to use the META-INF/services/javax.xml.transform.TransformerFactory file but it didn't work.
    Any ideas?

  • How to know database name and schema name

    Hi ,
    Once after logging in the database,how is it possible to know the current database and schema which we r using?Is there any system table where we can get the database names and schema names?
    please help me out.itz urgent.
    Regards,
    Sravan

    Probably not.
    If the database name is the name of the current database, it would be essentially redundant. If the database name is the name of some other database, in order to get the names of all the tables in the specified schema, you could create a database link to the remote system (which assumes you have a login and password to the remote database with appropriate privileges, that the database server's tnsnames.ora file has an entry for the remote database, etc) and query the remote data dictionary tables. Even if you could do that, however, you could not dynamically create triggers on the remote database since DDL over a database link.
    In theory, you could also load an appropriate JDBC driver into the database and write a Java stored procedure that would connect to the remote database (again, with an appropriate user name & password, host name, and port number) and issue DDL against that remote database. I have a hard time believing, however, that this would be a particularly beneficial approach. It would be easier just to put the appropriate code into each database that needs triggers generated or to have a separate Java application that generates triggers for a number of different databases.
    Justin

  • How to know database name and schema name by providing package name?

    Hi,
    Could someonw will help me to get database name and schema name by providing package name ?
    I have used the query : select * from all_objects where object_name='Package_name'; but it simply returns schema name where as i need DB name and username.
    --Prajakta

    but it simply returns schema name where as i need DB name and username.
    i want to retrive the DB name for package name
    Based on your questions, I wonder if you are used to working in SQL Server? (The server, database, and schema are part of the 4-part  name of an object, independent of any user.)
    In SQL Server, schema and username are two separate physical concepts.  "Schema" is purely logical in Oracle: a user which owns objects is often called a "schema".
    In Oracle, "database" is roughly equivalent to the SQL Server concept  "server" (what you log in to).  It is not part of the naming path to a specific object  (unless there is a database link involved, but there is no indication that's what you have here).  In Oracle you connect to an Instance (or Service) and people often call this the "database", but there is a fine semantic distinction there (separate topic). 
    Once connected in Oracle, you fully-qualify an object by only a 2-part owner and object name (possibly 3-part if a database link is involved user.object@link).
    12c added another wrinkle to all of this, but I'll assume this question was more basic than that, because you likely would have mentioned if this was a 12c question.

  • What is the impact on an Exchange server when moving FSMO role and schema master into another DC?

    What is the impact on an Exchange server when moving FSMO role and schema master into another DC? What do we have to do on exchange after performing a such task?
    I had 1 DC (Windows server 2008 R2), 1 Exchange 2010 SP3. I install a new DC (Windows server 2008 R2). I then move all the FSMO role including the schema master role into the NEW DC. I check to be sure that the new DC is a GC as well.
    I shutdown the old DC and my Exchange server was not working properly and specially Exchange Management Shell. It start working again after I turn up the older DC.
    I am wondering why Exchange did not recognize the new DC, even after moving all the roles on it.
    I am looking to hearing from you guys.
    Thanks a lot

    if you only have 1 DC, you might need to cycle the AD Topology service after shutting the one down.
    Also, take a look in the windows logs, there should be an event where Exchange goes to discover Domain Controllers, make sure both are listed there.  You can probably force that by cycling AD topology (this will take all services down so be careful
    when you do it)
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread

  • Workspace and Schema Guidance

    Hi - We're setting up Apex and want to plan out how to handle workspaces and schemas in advance. In previous settings, workspaces were set up by department with one schema. It started to get messy as more applications were built and development and production was all done in the same place.
    I was thinking that users could have their own development workspaces all associated with a development schema. Future workspaces would be created for each new project associated with the development schema previously mentioned and then separate workspaces for the project each associated with test and production schemas separately.
    I've read through related postings but hoped that someone might have comments/pros/cons this structure:
    WUser1Dev => SDevelopment
    (Continue for each individual developer using the same schema)
    WProject1Dev => SDevelopment
    WProject1Test => STest
    WProject1Production => SProduction
    (Continue for each individual Project using the same schemas)
    where W = Workspace and S = Schema

    Related thoughts here: Re: Workspace Guidance .
    Also consider that a dev-test-prod model where each is a separate database and in which workspace IDs are identical in each database (for each named workspace) is a whole lot easier to manage in terms of promoting revised applications and especially application components than a model in which dev-test-prod are separate workspaces that simply separate groups of developers from one another but where the applications within each workspace have functional counterparts in the others.
    Also, it is essential that applications that need to interact with one another at runtime, by sharing session state and certain authentication-related machinery must belong to a common workspace.
    Scott

  • DAD and schema in the URL

    Once I introduce the URL of a portal page,I don4t want to appear the dad and the schema in the URL, I want to appear only the address I introduced first.

    Can I create a new DAD and schema and change those parameters in the URL (dad, schema), so they are different from portal30/portal30?
    thanks in advance
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Paul Encarnacion ([email protected]):
    The servlet that does the page construction requires the parameters in the URL.<HR></BLOCKQUOTE>
    null

  • Can i drop the connection user and schema used for Accociate repository

    Hi
    I have created a connection , user and schema and Associated repository to it then migrated a database from diffrent product. to oracle
    using the above mentioned connection, user ,schema and asscociated repositroy.
    11g XE.
    can i delete it after the migration.
    yours sincerely.

    Yes you can !. Permission to drop those artifacts is granted except the target schema where the converted objects are. The migration repository user/connection can be dropped.

  • Move users and schemas from one instance to another

    Hi, I'm starting out in a DBA position.
    My task at the moment is to move users and schemas from one instance to another.
    We're using 9.2.0.7.
    I have concluded that the following steps are necessary to move users and schemas from one instance to another :
    1. Create the needed tablespaces.
    2. Create the users that exist in the source instance
    3. Use exp to do a full export
    4. Use imp to re-create the schemas from the output file created by exp in step 3
    Am I missing anything ?
    Thanks,
    Gabriel

    3. Use exp to do a full exportInstead of doing a FULL export just export the users you want to move and imp that in other database using FROMUSER & TOUSER parameter.
    Daljit Singh

Maybe you are looking for

  • MacBook Pro 17" Hard Drive and RAM suggestions

    Hi, I want to but the new 17" MacBook Pro with 3.06GHz processor. I am still unsure whether to choose 4GB or 8GB RAM as well as whether to choose SSD or HDD. This MacBook will be used to develop iPhone apps, so I would want to have it speedy. On the

  • Not able to link inbound to outbound in cross dock

    Hi, we have a warehouse managment setup in our project we are using cross dock process linking of my inboun delivery to outbound delivery. In my inbound delivery consits of 2 materials amd my outbound also consists of the same materials while i am go

  • Problem while deleting assets

    Dear All:                   I am trying to delete some assets through AS06 , These assets were earlier purchased through Purchase order and down payments were made through F-48. Complete MIRO have been done for these PO and no any balance is left in

  • Sound issue for Realtek ALC650 chipset

    I've read alot in the forums and tried I believe correctly to install this but I don't believe I'm getting the right module. Does anyone have an idea what module (if it's in the kernel) to use or do I have to go about finding the source? and compilin

  • Importing photos from iPhone to computer

    Am I able to import photos from my iPhone to my computer again after I have already imported them once? I can't find a setting to allow me to do this. It will only import new ones.