How to validate XML using java_xml_pack-summer-02?
In jaxp1.1, we validate the xml file in this way:
c:\java -jar Validator.jar myBookStore.xml
However, in java_xml_pack-summer-02, which is latest version of jaxp, the Validator.jar is not available. So, how to validate xml file?
Pls help.
develop your own validator... here is a quick and dirty one, which spits exceptions when error are met:
import java.io.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
public class Validator
public static void main(String[] args) throws Exception {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setValidating(true);
spf.setNamespaceAware(true);
SAXParser sp = spf.newSAXParser();
sp.parse(new File(args[0]), new DefaultHandler());
}
Similar Messages
-
Hi All
please tell me how to validate xml using xsd
regardsTry using this link:
= http://www.google.nl/search?q=XML+validate+oracle for instance or
= use the search button on this forum and / or
= read the FAQ on this (XML DB FAQ
Thanks Eddie et all, for educating me via http://awads.net/wp/2006/11/14/barts-punishment-for-asking-dumb-questions (don't mind the URL , the info there is really useful)
The following link on this site is just brilliant: http://www.albinoblacksheep.com/flash/posting.php
Grz
Marco
Message was edited by:
mgralike -
Help: How to Validate XML using SAXParser and return the entire error list
Hi,
I have a problem, I'm trying to validate a xml document against the DTD. Here Im using SAXParser and having the ErrorHandler object passed when setting the error Handler, like parser.setErrorHandler(errorHandlerObj).
I need an output like where the entire XML document is read and all the errors have to be reported with the line number.
like example:
<b>Line 6: <promp>
[Error]:Element type "promp" must be declared.
Line 8: </prompt>
[Fatal Error]:The end-tag for element type "promp" must end with a '>' delimiter.
who can i achieve this.</b>
what happens with the present code is that it throws the first error it encountered and comes out.
how can i solve this problemYou can try to set the following feature to 'true' for your SAXParser:
http://apache.org/xml/features/continue-after-fatal-error
At least Xerces supports this feature. -
How to validate XML against XSD and parse/save in one step using SAXParser?
How to validate XML against XSD and parse/save in one step using SAXParser?
I currently have an XML file and XSD. The XML file specifies the location of the XSD. In Java code I create a SAXParser with parameters indicating that it needs to validate the XML. However, SAXParser.parse does not validate the XML, but it does call my handler functions which save the elements/attributes in memory as it is read. On the other hand, XMLReader.parse does validate the XML against the XSD, but does not save the document in memory.
My code can call XMLReader.parse to validate the XML followed by SAXParser.parse to save the XML document in memory. But this sound inefficient. Besides, while a valid document is being parsed by XMLReader, it can be changed to be invalid and saved, and XMLReader.parse would be looking at the original file and would think that the file is OK, and then SAXParser.parse would parse the document without errors.
<Book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="book.xsd" name="MyBook">
<Chapter name="First Chapter"/>
<Chapter name="Second Chapter">
<Section number="1"/>
<Section number="2"/>
</Chapter>
</Book>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Book">
<xs:complexType>
<xs:sequence>
<xs:element name="Chapter" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Section" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="xnumber"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name"/>
</xs:complexType>
</xs:element>
</xs:schema>
public class SAXXMLParserTest
public static void main(String[] args)
try
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
SAXParser parser = factory.newSAXParser();
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
BookHandler handler = new BookHandler();
XMLReader reader = parser.getXMLReader();
reader.setErrorHandler(handler);
parser.parse("xmltest.dat", handler); // does not throw validation error
Book book = handler.getBook();
System.out.println(book);
reader.parse("xmltest.dat"); // throws validation error because of 'xnumber' in the XSD
public class Book extends Element
private String name;
private List<Chapter> chapters = new ArrayList<Chapter>();
public Book(String name)
this.name = name;
public void addChapter(Chapter chapter)
chapters.add(chapter);
public String toString()
StringBuilder builder = new StringBuilder();
builder.append("<Book name=\"").append(name).append("\">\n");
for (Chapter chapter: chapters)
builder.append(chapter.toString());
builder.append("</Book>\n");
return builder.toString();
public static class BookHandler extends DefaultHandler
private Stack<Element> root = null;
private Book book = null;
public void startDocument()
root = new Stack<Element>();
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
if (qName.equals("Book"))
String name = attributes.getValue("name");
root.push(new Book(name));
else if (qName.equals("Chapter"))
String name = attributes.getValue("name");
Chapter child = new Chapter(name);
((Book)root.peek()).addChapter(child);
root.push(child);
else if (qName.equals("Section"))
Integer number = Integer.parseInt(attributes.getValue("number"));
Section child = new Section(number);
((Chapter)root.peek()).addSection(child);
root.push(child);
public void endElement(String uri, String localName, String qName) throws SAXException
Element finished = root.pop();
if (root.size() == 0)
book = (Book) finished;
public Book getBook()
return book;
public void error(SAXParseException e)
System.out.println(e.getMessage());
public void fatalError(SAXParseException e)
error(e);
public void warning(SAXParseException e)
error(e);
public class Chapter extends Element
public static class Section extends Element
private Integer number;
public Section(Integer number)
this.number = number;
public String toString()
StringBuilder builder = new StringBuilder();
builder.append("<Section number=\"").append(number).append("\"/>\n");
return builder.toString();
private String name;
private List<Section> sections = null;
public Chapter(String name)
this.name = name;
public void addSection(Section section)
if (sections == null)
sections = new ArrayList<Section>();
sections.add(section);
public String toString()
StringBuilder builder = new StringBuilder();
builder.append("<Chapter name=\"").append(name).append("\">\n");
if (sections != null)
for (Section section: sections)
builder.append(section.toString());
builder.append("</Chapter>\n");
return builder.toString();
}Edited by: sn72 on Oct 28, 2008 1:16 PMHave you looked at the XML DB FAQ thread (second post) in this forum? It has some examples for validating XML against schemas.
-
How to validate xml file with XSD schema ?? in JDK1.4.2
How to validate xml file with XSD schema ?? in JDK1.4.2
i dont want to use new Xerec Jar ...
Suggest option ...Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
Then use Stax (Woodstock) or Saxon.
- Saish -
How to Validate XML against XSD through PL/SQL?
Hi friends,
I m new to this forum. This is my first query.
In our project, we are trying to generate output XML using PL/SQL procedure. I have done that successfully. Now my problem is I have to validate this against our XSD. How will I do that? Can you provide me with a sample example.
Thanks to all in advance.
Regards,
apkHave you looked at the XML DB FAQ thread (second post) in this forum? It has some examples for validating XML against schemas.
-
How to validate xml againest to xsd
HI,
Xml contains multiple namespaces , I want validate xml againest to xsd. please any one can give help to me.
thanks in adwance,see the sample code which fulfill ur need...
/*--------------Validate.java------------------*/
import java.io.File;
import java.io.StringReader;
import javax.xml.XMLConstants;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.xml.sax.SAXException;
* This sample shows how new Validator APIs can be used to compile a standalone schema. This
* feature is useful for those applications which are developing schema and wants to check
* the validity of it as per the rules of schema language.
* Once an application has <code>Schema</code> object, it can be used to create
* <code>Validator</code> which can be used to validate an instance document against the
* schema or set of schemas this <code>Schema</code> object represents.
public class Validate
private static final boolean DEBUG = System.getProperty("debug") != null ? true : false;
/** Parser the given schema and return in-memory representation of that
* schema. Compiling the schema is very simple, just pass the path of schema
* to <code>newSchema()</code> function and it will parse schema, check the
* validity of schema document as per the schema language, compute in-memory
* representation and return it as <code>Schema</code> object. Note that If
* schema imports/includes other schemas, those schemas will be parsed too.
* @param String path to schema file
* @return Schema in-memory representation of schema.
public static Schema compileSchema(String schema) throws SAXException
//Get the SchemaFactory instance which understands W3C XML Schema language
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
if(DEBUG)
System.out.println("schema factory instance obtained is " + sf);
return sf.newSchema(new File(schema));
}//compileSchema
* @param args the command line arguments
public static void main(String[] args)
try
//parse schema first, see compileSchema function to see how
//Schema object is obtained.
Schema schema = compileSchema("NBO.XSD");
//this "Schema" object is used to create "Validator" which
//can be used to validate instance document against the schema
//or set of schemas "Schema" object represents.
Validator validator = schema.newValidator();
//set ErrorHandle on this validator
validator.setErrorHandler(new MyErrorHandler());
//Validate this instance document against the instance document supplied
validator.validate(new StreamSource("NBWO.XML"));
} catch(Exception ex)
ex.printStackTrace();
System.out.println("GET CAUSE:");
ex.getCause().fillInStackTrace();
/*---------MyErrorHandler()-----------*/
* MyErrorHandler.java
public class MyErrorHandler implements org.xml.sax.ErrorHandler
/** Creates a new instance of MyErrorHandler */
public MyErrorHandler()
public void error(org.xml.sax.SAXParseException sAXParseException) throws org.xml.sax.SAXException
System.out.println("ERROR: " + sAXParseException.toString());
System.out.println("get error Msg : "+sAXParseException.getMessage());
public void fatalError(org.xml.sax.SAXParseException sAXParseException) throws org.xml.sax.SAXException
System.out.println("FATAL ERROR: " + sAXParseException.toString());
System.out.println("get Error Message : "+sAXParseException.getMessage());
public void warning(org.xml.sax.SAXParseException sAXParseException) throws org.xml.sax.SAXException
System.out.println("WARNING: " + sAXParseException.toString());
}With Cheers,
Prasanna T -
How to send XML using UTL_HTTP
I am trying to workout how to send XML data to a webserver using UTL_HTTP but am not getting any reply
I need to submit the following XML document to a server "http://api.fastsms.co.uk/api/xmlapi.php" Their instructions are "The XML Document should be posted unencoded, with a UTF-8 character set as parameter 'xml'"
If I submit the following XML on their test form
<?xml version="1.0"?>
<apirequest version="1">
<user>
<username>**USER**</username>
<password>**PASSWORD**</password>
</user>
<application>
<name>Example Application</name>
<version>1.0</version>
</application>
<inboundcheck lastid="10711399"/>
</apirequest>
I get an XML response back with the messages in my inbox.
This is the code I am trying to use to accomplish the same from PL/SQL : I know a response is coming back as there is header information - just no content. What am I doing wrong ?
l_xml VARCHAR2(5000);
req utl_http.req;
resp utl_http.resp;
header_name VARCHAR2(256); -- Response header name
header_value VARCHAR2(1024); -- Response header value
response_text VARCHAR2(4000); -- Response body
l_url VARCHAR2(100);
BEGIN
l_xml := 'xml=<?xml version="1.0"?>';
l_xml := '<apirequest version="1">';
l_xml := '<user>';
l_xml := '<username>**USER**</username>';
l_xml := '<password>**PASSWORD**</password>';
l_xml := '</user>';
l_xml := '<application>';
l_xml := '<name>Example Application</name>';
l_xml := '<version>1.0</version>';
l_xml := '</application>';
l_xml := '<inboundcheck lastid="10711399"/>';
l_xml := '</apirequest>';
-- Open HTTP connection
l_url := 'http://api.fastsms.co.uk/api/xmlapi.php';
req := utl_http.begin_request(l_url,'POST',utl_http.HTTP_VERSION_1_1);
-- Set headers for type and length
utl_http.set_header(req,'Content-Type','application/x-www-form-urlencoded');
utl_http.set_header(req,'Content-Length',to_char(length(l_xml)));
-- Write parameter
utl_http.write_text(req,l_xml);
-- Read response file
resp := utl_http.get_response(req);
-- Print out the response headers
FOR i IN 1 .. utl_http.get_header_count(resp) LOOP
utl_http.get_header(resp,i,header_name,header_value);
logging_pkg.info(header_name || ': ' || header_value);
END LOOP;
-- Print out the response body
BEGIN
LOOP
utl_http.read_text(resp,response_text);
logging_pkg.info(response_text);
END LOOP;
EXCEPTION
WHEN utl_http.end_of_body THEN
logging_pkg.info('End of body');
END;
-- close http connection
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;
Cheers,
BrentHi Billy
Yikes - how embarassing ! Thanks for pointing out my beginners mistake there. I've fixed my code - and also implemented the substitutions of parameters like you suggested - I like that approach.
Unfortunately the end result is no better - the line
utl_http.read_text(resp,response_text);
Still returns nothing back
The headers that are coming back are
Date: Thu, 04 Jul 2013 08:31:56 GMT
Server: Apache/2.2.16 (Ubuntu)
X-Powered-By: PHP/5.3.3-1ubuntu9.3
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Connection: close
I guess I will need to try chasing it with the fastsms vendor so see if they can check my incoming request and see if there are any glaring problems. I know the xml is correct as I am now logging the xml string just before I send it and when I take that string and put it in their test form it works perfectly - something else in the puzzle is missing. I've had no experience using utl_http before - perhaps it's no possible to read the xml repsonse using this ?
Anyway, thanks for your help Billy.
ps - How do you paste your code into your message to get that formatting ?
Cheers,
Brent -
How to validate XML Digital Signature with XML DB (o PL/SQL) in Oracle 11g
Hi,
Do you know if there is possibility to validate XML Digital Signature using XML DB (or PL/SQL) in Oracle 11g?
Let say I have CLOB/XMLType containing Digitally Signed XML, and I want to validate, that thsi is proper signature. I also have public key of signer (I could store it in CLOB or file or Oracle wallet).
Is it possible to do?
If there is need to install additional component - then which one?
Regards,
PawełHi,
this is what i got from someone...
but the links he gave are not opening up...
u have to place a picture there and have to load the digital signatures as Jpegs on to the server to OA top
and have to refer them in the XML for dynamically get the signature on the reports
when u select the properties of the picture placed in the XML template,
there will be one tab with "URL"... in that u have to give the path for that jpegs
Pls refer the following documents for enabling digital signature on pdf documents.
http://iasdocs.us.oracle.com/iasdl/bi_ee/doc/bi.1013/e12187/T421739T481159.htm#5013638 (refer section 'Adding or Designating a Field for Digital Signature'
http://iasdocs.us.oracle.com/iasdl/bi_ee/doc/bi.1013/e12188/T421739T475591.htm#5013688
(Implementing a Digital Signature
Is the BI Publisher installed on your instance of version 10.1.3.4 or higher?
Pls procure a digital signature as soon as possible. The process can take time. OR we could use any certificate that you already might have OR generate a certificate using Oracle Certificate Authority for demo. -
Validate XML using XSD (XML Schema)
Hi experts.
Is there any way in ABAP to validate XML file against specified XSD file?
I found only possibility to validate against DTD, but no XSD. As far as I know this is only possible in Java, or is a part of XI. Is it doable without Java or XI (on NetWeaver 2004s)?
Help appreciated (and rewarded).
Regards, Frantisek.Hello
Perhaps you missed this link: [How to Perform XML Validations in SAP NetWeaver Process Integration 7.1|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d06dff94-9913-2b10-6f82-9717d9f83df1]
Regards
Uwe -
How to Validate this using Regular Expressions
Hi All,
I have following types of Mail IDs, Each is a String.
It may be either of the Following:
[email protected]
or
Ameer<[email protected]>
Then How to validate using the Regular Expressions.use this regex.. might need to convert it from perl regex flavor:
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
)*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+
|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r
\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:
\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t
]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031
]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](
?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?
:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?
:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?
:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?
[ \t]))*"(?:(?:\r\n)?[ \t])*)*:(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|
\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>
@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"
(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?
:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[
\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-
\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(
?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;
:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([
^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\"
.\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\
]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\
[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\
r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]
|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \0
00-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\
.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,
;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?
:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[
^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]
]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)(?:,\s*(
?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(
?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[
\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t
])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t
])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?
:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
\t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
"()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
?:\r\n)?[ \t])*))*)?;\s*) -
How to generate xml using "Data Template"
Hi,
Can any one please tell me the steps to create xml using "Data Template".
As per the user guide the execution method for "data Template" is "Java Concurrent Program" and the Executable mentiones is "XDODTEXE".
But there is no information about the "execution file name" and "execution path name" which is mandatory.
Thanks and Regards,
SandhyaHi Sandhya,
To put a Data Template into use, you don't need to define any new executables. XDODTEXE executable is already registered in the system, as it ships with the application. The Data Template is not an executable as such, but a collection of instructions for what queries to perform and what should the resulting XML look like. XDODTEXE knows how to interpret those instructions, and produce the XML output.
(And if you add a layout template, handle that too.)
You do need to do the following:
1) Create a new Data Definition (XML Publisher Administrator > Data Definitions)
2) Upload your Data Template (remember the Code for the next step)
3) Create a Concurrent Program that is linked to the Data Definition (Short Name = Code) (System Administrator > Program > Define)
4) Add your Concurrent Program to a Request Group (System Administrator > Security > Responsibility > Request)
I recommend you take a look at the XML Publisher Administration and Developer's Guide, you will find more information there.
(http://download-west.oracle.com/docs/cd/B40089_02/current/acrobat/120xdoig.pdf)
Best Regards & Happy New Year 2008,
Matilda Smeds -
How to validate XML files using several XSD?
hi friends i need java code for this application >?
Plz. help me urgent............Use the parser property
http://apache.org/xml/properties/schema/external-schemaLocation
to specify more than one schemas.
http://xerces.apache.org/xerces2-j/properties.html -
How to validate XML Schema in DOM?
I've got an XML file and corresponding XSD file.
How do I validate this XML file when using DOM parser?
ThanksYou can use the sun msv API.
This multi schema validator can validate documents against different sorts of Schema.
More info at http://wwws.sun.com/software/xml/developers/multischema/ -
How to read XML using vbscript
hi friends I have A big XML having following format :
<ECSC>
<ATTRIBUTES>
<ETTOOLNAME>ECATT</ETTOOLNAME>
<ETOBJ_GNDT>
<VERSION>00000001</VERSION>
<TWB_TITLE>TF_FI_FP_FI_0569_MS07_CO_Search_Help_Internal_Orders_vTD0_1_EN.x</TWB_TITLE>
<TWB_STATUS>X</TWB_STATUS>
<TWB_RELE>N</TWB_RELE>
<FUSER>ECATT</FUSER>
<FDATE>2014-05-22</FDATE>
<LUSER>ECATT</LUSER>
<LDATE>2014-05-22</LDATE>
<LTIME>13:59:50</LTIME>
</ETOBJ_GNDT>
<ETOBJNOVER>
<NAME>ZX_FI_FP_0569_MS07_COAS_FB01</NAME>
<TYPE>ECSC</TYPE>
<TWB_RESP>ECATT</TWB_RESP>
<TWB_DISTL>B</TWB_DISTL>
<DEVCLASS>Z_SOL_ONEERP</DEVCLASS>
<MASTERLANG>E</MASTERLANG>
<TADIR_RESP>ECATT</TADIR_RESP>
<FRANGE>BC</FRANGE>
</ETOBJNOVER>
<ETOBJ_DOC>
<SEARCH_1>FI_FP_FI_0569_MS07</SEARCH_1>
<SEARCH_2>COAS</SEARCH_2>
<SEARCH_3>KO03</SEARCH_3>
</ETOBJ_DOC>
<ETOBJ_CNST>
<TWB_WKREQ>0.000</TWB_WKREQ>
<TWB_PRIO>3</TWB_PRIO>
</ETOBJ_CNST>
<ETSC_TSYS>
<SYSTEMDATA>Z_SD_1ERP_Z</SYSTEMDATA>
<TESTSYSTEM>FI_TRUSTED_EN</TESTSYSTEM>
</ETSC_TSYS>
<ETSYS_COMP_TABTYPE/>
<ETSYS_REL_TABTYPE/>
</ATTRIBUTES>
<SCRIPT>
<ETXML_LINE_TABTYPE>
<item>***********************************************************************.</item>
<item>* Information.</item>
<item>**********************************************************************.</item>
<item>* Script for test case 'TF_FI_FP_FI_0569_MS07_CO_Search_Help_Internal_Orders_vTD0_1_EN.x'</item>
<item>*</item>
<item>* For Sub script:</item>
<item>* 'Test case 3: Choose an Internal Order in One.Fi using external order number while transaction posting (positive case)'.</item>
<item>*</item>
<item>* Script is to Display Internal Order using external order number while Transaction Posting 'FB01'</item>
<item>* GETTAB command is being used to fetch the data from table 'COAS'.</item>
<item>*</item>
<item>*</item>
<item>* Test data related Information</item>
<item>* -----------------------------</item>
<item>* Default test data present in parameter list has been used while Scripting ( script recording & Performing Checks ).</item>
<item>*</item>
<item>* Final execution of result log: 0000037077.</item>
<item>*</item>
<item>***********************************************************************.</item>
<item>* Preparation.</item>
<item>***********************************************************************.</item>
<item/>
<item/>
<item>***********************************************************************.</item>
<item>* End Preparation.</item>
<item>************************************************************************.</item>
<item/>
<item/>
<item>***********************************************************************.</item>
<item>* Execution.</item>
<item>***********************************************************************.</item>
<item>* To get the 'Table Entries' from table 'COAS'.</item>
<item> GETTAB ( COAS , COAS_1 ).</item>
<item>* To display the value for the field 'External Order No'.</item>
<item> LOG ( V_EXTERNAL_ORDER_NO_FRM_TABL ).</item>
<item/>
<item>*----------------------Posting(FB01)-------------------------------------------*.</item>
<item/>
<item>* This part of Script is to Display Internal Order using external order number while Transaction Posting 'FB01'.</item>
<item>MESSAGE ( MSG_1 ).</item>
<item>* To get the name of the Title Screen.</item>
<item> GETGUI ( FB01_100_STEP_1 ).</item>
<item>* Enter the Required details and Press Enter.</item>
<item> SAPGUI ( FB01_100_STEP_2 ).</item>
<item>* Enter Amount and Tax Code.</item>
<item>* and, Press F4 help in the Order Field.</item>
<item> SAPGUI ( FB01_300_STEP_1 ).</item>
<item>* In F4 screen, enter the 'External Order Number'</item>
<item>* pop-up screen is displayed with entries like Order, Description and External Order Number and select 1st order row, press Enter.</item>
<item> SAPGUI ( FB01_200_STEP_1 ).</item>
<item>* To get the values for the field 'Order, Description and External Order No' from F4 help.</item>
<item> GETGUI ( FB01_120_STEP_1 ).</item>
<item> SAPGUI ( FB01_120_STEP_3 ).</item>
<item>* To get the value for the field 'Order' from Main screen.</item>
<item> GETGUI ( FB01_300_STEP_2 ).</item>
<item>* click on 'F3' back button.</item>
<item> SAPGUI ( FB01_300_STEP_3 ).</item>
<item>* click on 'F3' back button.</item>
<item> SAPGUI ( FB01_700_STEP_1 ).</item>
<item>* click 'Yes' button.</item>
<item> SAPGUI ( FB01_200_STEP_2 ).</item>
<item>* click on 'F3' back button.</item>
<item> SAPGUI ( FB01_100_STEP_3 ).</item>
<item>ENDMESSAGE ( E_MSG_1 ).</item>
<item/>
<item>* To display the Title Screen.</item>
<item> LOG ( V_TITLE_SCREEN ).</item>
<item>* To display the 'Order' Number from F4 help.</item>
<item> LOG ( V_ORDER_NO_FROM_F4 ).</item>
<item>* To display the 'Description' from F4 help.</item>
<item> LOG ( V_DESCRIPTION_FROM_F4).</item>
<item>* To display the 'External Order no' value from F4 help.</item>
<item> LOG ( V_EXTERNAL_ORDER_NO_FROM_F4 ).</item>
<item>* To display the 'Order' Number from main screen.</item>
<item> LOG ( V_ORDER_NO_FRM_MAIN_SCREEN ).</item>
<item>************************************************************************.</item>
<item>* End Execution.</item>
<item>***********************************************************************.</item>
<item/>
<item>***********************************************************************.</item>
<item>* Check.</item>
<item>***********************************************************************.</item>
<item>* To check name of Title screen for transaction FB01.</item>
<item> CHEVAR ( V_TITLE_SCREEN = I_TITLE_SCREEN ).</item>
<item>* To check the value for the field 'External Order No' from F4 help, which should be equal to 'External Order No' from table.</item>
<item> CHEVAR ( V_EXTERNAL_ORDER_NO_FRM_TABL = V_EXTERNAL_ORDER_NO_FROM_F4 ).</item>
<item>* To check the values for the field 'Order' number from Table, which should be equal to 'Order' no from F4 screen and Main screen.</item>
<item> CHEVAR ( ( I_ORDER_NUMBER_FROM_TABLE = V_ORDER_NO_FROM_F4 ) AND ( I_ORDER_NUMBER_FROM_TABLE = V_ORDER_NO_FRM_MAIN_SCREEN )).</item>
<item>************************************************************************.</item>
<item>* End Check.</item>
<item>************************************************************************.</item>
</ETXML_LINE_TABTYPE>
</SCRIPT>
<PARAMETERS>
<ETPAR_GUIX>
<item>
<PNAME>COAS_1</PNAME>
<PTYP>X</PTYP>
<PDESC>Generated Table for View</PDESC>
<PINDEX>0001</PINDEX>
<PGROUP>GETTAB</PGROUP>
<XMLREF_TYP>T</XMLREF_TYP>
<PSTRUC_TYP>T</PSTRUC_TYP>
<PREF_TYPE>VIEW</PREF_TYPE>
<PREF_NAME>COAS</PREF_NAME>
<PDATLEN>0000</PDATLEN>
<PINTLEN>000000</PINTLEN>
<PDECIMALS>000000</PDECIMALS>
<SORT_LNR>0001</SORT_LNR>
<PREF_NAME2>COAS</PREF_NAME2>
<VALUE><VALUE></VALUE>
<VAL_TYPE>T</VAL_TYPE>
<TAB_INDEX>0</TAB_INDEX>
</item>
<item>
<PNAME>IOAS_1</PNAME>
<PTYP>I</PTYP>
<PDESC>Generated Table for View</PDESC>
<PINDEX>0001</PINDEX>
<PGROUP>IETTAB</PGROUP>
<XMLREF_TYP>T</XMLREF_TYP>
<PSTRUC_TYP>T</PSTRUC_TYP>
<PREF_TYPE>VIEW</PREF_TYPE>
<PREF_NAME>COAS</PREF_NAME>
<PDATLEN>0000</PDATLEN>
<PINTLEN>000000</PINTLEN>
<PDECIMALS>000000</PDECIMALS>
<SORT_LNR>0001</SORT_LNR>
<PREF_NAME2>COAS</PREF_NAME2>
<VALUE><VALUE></VALUE>
<VAL_TYPE>T</VAL_TYPE>
<TAB_INDEX>0</TAB_INDEX>
</item>
</ETPAR_GUIX>
</PARAMETERS>
</ECSC>
I want to write vbscript for above XML file. Vbscript should display following result :
1) It should validate <SCRIPT> node The line staring with * symbol is called comment and the line staring without * symbol is call code in above XML file.
2) Vb Script should display such line numbers those code don't have any comment line specified.
for example : In above XML the code line : <item> SAPGUI ( FB01_120_STEP_3 ).</item> it doesn't have any comment line means this code don't have any comment. So vbscript should find such line numbers and code text and show error message.
3) Each code had its own comment just above line of code.
4) In <PARAMETER> node we have to check <PNAME> is staring with letter "I" or not.. If its staring with letter "I" then its <PTYPE> and <PGROUP> staring letter should be "I". We have to check this condition
for every child node of <PARAMETER> node using vbscript.
Please help me and Thank You so much in advance.
My Vb Script is as follows :
filename = "D:\Automation\o.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(filename)
fl=0
Do Until f.AtEndOfStream
strLine = f.ReadLine
if (strLine ="MESSAGE ( MSG_1 ).") then
Document.write("<br>Inside MESSAGE ")
Do until f.AtEndOfStream
strLine = f.ReadLine
if((Left(strLine,1)="*"))
Then
if((Right(strLine,1)="."))
then
Document.write("<br>ERROR Found at Line No :" & f.line-1&" "& strLine)
end if
fl=1
else
if((Right(strLine,1)=".")
and (fl=1))Then
fl=0
else
Document.write("<br>ERROR Found at Line No :" & f.line-1&" "& strLine)
end if
end if
Loop
end if
And the following code for <PARAMETER> tag :
Const XMLDataFile = "D:\Automation\imp\p.xml"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)
xmlDoc.validateOnParse = True
If xmlDoc.Load(XMLDataFile) Then
Document.write "SUCCESS loading XML File"
Else
Document.write "ERROR loading XML File"
End If
counter=0
Set root = xmlDoc.documentElement
Set items = root.childNodes
for each item in items
myPNAME = xmlDoc.getElementsByTagName("PNAME").item(counter).text
myPTYP = xmlDoc.getElementsByTagName("PTYP").item(counter).text
myPGROUP = xmlDoc.getElementsByTagName("PGROUP").item(counter).text
If (Left(myPNAME, 1) = "I") Then
'Document.write("myPNAME Starts with I")
IsValid = True
'Innocent until proven guilty
If (Left(myPTYP, 1) <> "I") Then
IsValid = False
End If
If (Left(myPGROUP, 1) <> "I" )Then
IsValid = False
End If
If IsValid = False Then
Document.write(myPNAME & " is not valid.")
End If
IsValid = True
End If
If (Left(myPNAME, 1) = "V") Then
'Document.write("myPNAME Starts with I")
IsValid = True
'Innocent until proven guilty
If (Left(myPTYP, 1) <> "V") Then
IsValid = False
End If
If (Left(myPGROUP, 1) <> "V" )Then
IsValid = False
End If
If IsValid = False Then
Document.write(myPNAME & " is not valid.")
End If
IsValid = True
End If
If (Left(myPNAME, 1) = "E") Then
'Document.write("myPNAME Starts with I")
IsValid = True
'Innocent until proven guilty
If (Left(myPTYP, 1) <> "E") Then
IsValid = False
End If
If (Left(myPGROUP, 1) <> "E" )Then
IsValid = False
End If
If IsValid = False Then
Document.write(myPNAME & " is not valid.")
End If
IsValid = True
End If
counter=counter+1
next
Here is a better example of how to pull all of the text.
strXmlFile = "D:\Automation\imp\p.xml"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
If xmlDoc.Load(strXmlFile) Then
WScript.Echo "SUCCESS loading XML File"
Else
WScript.Echo "ERROR loading XML File"
End If
Set items = xmlDoc.SelectNodes("//SCRIPT/ETXML_LINE_TABTYPE/item")
For Each item In items
WScript.Echo item.Text
Next
¯\_(ツ)_/¯
Maybe you are looking for
-
Client_Get_File_Name webutil
Hello all, i am new to oracle development and i am trying to do the forms exercises in oracle 10g. However, when i got to uploading images in Client_get_file_name, there is an error: I have a code in an image button. Here it is: DECLARE v_file VARC
-
HT1338 how to download adobe reader on macbook pro
how to download adobe reader on macbook pro?
-
Problem in the main area of the table not coming on the same page
Hi Experts, I have created a invoice in the table header with descriptions and main area with the values,below main area i have also created a template in smartform for calculation when i have assigned this to a transaction and i goto printpreview my
-
How do I create a new album in my photos on my iPad 2?
I want to organize the photos on my iPad into different albums. How do I do that without a computer?
-
PCI-MXI-2 Linux driver 2.0 for kernel 2.4
I would like to understand who *exactly* I should be getting this software from. Thanks, Andre