VBS 클래스는 xml 파일을 생성합니다.
재인쇄할 때 소스를 표시하십시오. vbs 클래스 생성 xml 파일
에는 두 개의 파일이 있습니다:
objXML.asp: 테스트 파일
clsXML.asp: vbs 클래스 파일
코드:
objXML.asp <%@ Language=VBScript %><% Option Explicit %><!--#INCLUDE FILE='clsXML.asp'--><%Dim objXML, strPath, strSet objXML = New clsXML strPath = Server.MapPath('.') & '\New.xml' objXML.createFile strPath, 'Root''Or If using an existing XML file:'objXML.File = 'C:\File.xml' objXML.createRootChild 'Images' 'Here only one attribute is added to the Images/Image NodeobjXML.createChildNodeWAttr 'Images', 'Image', 'id', '1'objXML.updateField 'Images//Image[@id=1]', 'super.gif'objXML.createRootNodeWAttr 'Jobs', Array('Size', 'Length', 'Width'), _Array(24, 31, 30)objXML.createRootNodeWAttr 'Jobs', Array('Size', 'Length', 'Width'), _Array(24, 30, 29)objXML.createRootNodeWAttr 'Jobs', Array('Size', 'Length', 'Width'), _Array(24, 31, 85) 'Notice that all three job nodes have size 24, all of those 'nodes will be updatedobjXML.updateField 'Jobs[@Size=24]', '24's' 'Notice that only two nodes have the specified XPath, hence 'only two new child nodes will be addedobjXML.createChildNodeWAttr 'Jobs[@Size=24 and @Length=31]', 'Specs', _Array('Wood', 'Metal', 'Color'), _Array('Cedar', 'Aluminum', 'Green') 'It is always important to iterate through all of the nodes'returned by this XPath query.For Each str In objXML.getField('Jobs[@Size=24]')Response. Write(str & '<br>')NextSet objXML = Nothing Response.Redirect 'New.xml'%> clsXML.asp: <%Class clsXML'strFile must be full path to document, ie C:\XML\XMLFile.XML'objDoc is the XML ObjectPrivate strFile, objDoc '*********************************************************************' Initialization/Termination'********************************************************************* 'Initialize Class MembersPrivate Sub Class_Initialize()strFile = ''End Sub 'Terminate and unload all created objectsPrivate Sub Class_Terminate()Set objDoc = NothingEnd Sub '*********************************************************************' Properties'********************************************************************* 'Set XML File and objDocPublic Property Let File(str)Set objDoc = Server.CreateObject('Microsoft.XMLDOM')objDoc.async = FalsestrFile = strobjDoc.Load strFileEnd Property 'Get XML FilePublic Property Get File()File = strFileEnd Property '*********************************************************************' Functions'********************************************************************* 'Create Blank XML File, set current obj File to newly created filePublic Function createFile(strPath, strRoot)Dim objFSO, objTextFileSet objFSO = Server. CreateObject('Scripting.FileSystemObject')Set objTextFile = objFSO.CreateTextFile(strPath, True)objTextFile.WriteLine('<?xml version=''1.0''?>')objTextFile. WriteLine('<' & strRoot & '/>')objTextFile.CloseMe.File = strPathSet objTextFile = NothingSet objFSO = NothingEnd Function 'Get XML Field(s) based on XPath input from root nodePublic Function getField(strXPath)Dim objNodeList, arrResponse(), iSet objNodeList = objDoc.documentElement. selectNodes(strXPath)ReDim arrResponse(objNodeList.length)For i = 0 To objNodeList.length - 1arrResponse(i) = objNodeList.item(i). TextNextgetField = arrResponseEnd Function 'Update existing node(s) based on XPath specsPublic Function updateField(strXPath, strData)Dim objFieldFor Each objField In objDoc.documentElement. selectNodes(strXPath)objField.Text = strDataNextobjDoc.Save strFileSet objField = NothingupdateField = TrueEnd Function 'Create node directly under rootPublic Function createRootChild(strNode)Dim objChildSet objChild = objDoc.createNode(1, strNode, '')objDoc.documentElement. appendChild(objChild)objDoc.Save strFileSet objChild = NothingEnd Function 'Create a child node under root node with attributesPublic Function createRootNodeWAttr(strNode, attr, val)Dim objChild, objAttrSet objChild = objDoc. createNode(1, strNode, '')If IsArray(attr) And IsArray(val) ThenIf UBound(attr)-LBound(attr) <> UBound(val)-LBound(val) ThenExit FunctionElseDim iFor i = LBound(attr) To UBound(attr)Set objAttr = objDoc.createAttribute(attr(i))objChild.setAttribute attr(i), val(i)NextEnd IfElseSet objAttr = objDoc. createAttribute(attr)objChild.setAttribute attr, valEnd IfobjDoc.documentElement.appendChild(objChild)objDoc.Save strFileSet objChild = NothingEnd Function 'Create a child node under the specified XPath NodePublic Function createChildNode(strXPath, strNode)Dim objParent, objChildFor Each objParent In objDoc. documentElement.selectNodes(strXPath)Set objChild = objDoc.createNode(1, strNode, '')objParent.appendChild(objChild)NextobjDoc.Save strFileSet objParent = NothingSet objChild = NothingEnd Function 'Create a child node(s) under the specified XPath Node with attributesPublic Function createChildNodeWAttr(strXPath, strNode, attr, val)Dim objParent, objChild, objAttrFor Each objParent In objDoc.documentElement.selectNodes(strXPath)Set objChild = objDoc.createNode(1, strNode, '')If IsArray(attr) And IsArray(val) ThenIf UBound(attr)-LBound(attr) <> UBound(val)-LBound(val) ThenExit FunctionElseDim iFor i = LBound(attr) To UBound(attr)Set objAttr = objDoc. createAttribute(attr(i))objChild.SetAttribute attr(i), val(i)NextEnd IfElseSet objAttr = objDoc.createAttribute(attr)objChild.setAttribute attr, valEnd IfobjParent.appendChild(objChild)NextobjDoc.Save strFileSet objParent = NothingSet objChild = NothingEnd Function 'Delete the node specified by the XPathPublic Function deleteNode(strXPath)Dim objOldFor Each objOld In objDoc.documentElement.selectNodes(strXPath)objDoc. documentElement.removeChild objOldNextobjDoc.Save strFileSet objOld = NothingEnd FunctionEnd Class%>
위는 vbs 클래스 생성 xml 파일의 내용입니다. 더 많은 관련 내용은 PHP 중국어 홈페이지를 참고해주세요. (www.php.cn)!

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











모바일 XML에서 PDF의 속도는 다음 요인에 따라 다릅니다. XML 구조의 복잡성. 모바일 하드웨어 구성 변환 방법 (라이브러리, 알고리즘) 코드 품질 최적화 방법 (효율적인 라이브러리 선택, 알고리즘 최적화, 캐시 데이터 및 다중 스레딩 사용). 전반적으로 절대적인 답변은 없으며 특정 상황에 따라 최적화해야합니다.

단일 애플리케이션으로 휴대 전화에서 직접 XML에서 PDF 변환을 완료하는 것은 불가능합니다. 두 단계를 통해 달성 할 수있는 클라우드 서비스를 사용해야합니다. 1. 클라우드에서 XML을 PDF로 변환하십시오. 2. 휴대 전화에서 변환 된 PDF 파일에 액세스하거나 다운로드하십시오.

휴대 전화에서 XML을 PDF로 직접 변환하는 것은 쉽지 않지만 클라우드 서비스를 통해 달성 할 수 있습니다. 가벼운 모바일 앱을 사용하여 XML 파일을 업로드하고 생성 된 PDF를 수신하고 클라우드 API로 변환하는 것이 좋습니다. Cloud API는 Serverless Computing Services를 사용하고 올바른 플랫폼을 선택하는 것이 중요합니다. XML 구문 분석 및 PDF 생성을 처리 할 때 복잡성, 오류 처리, 보안 및 최적화 전략을 고려해야합니다. 전체 프로세스에는 프론트 엔드 앱과 백엔드 API가 함께 작동해야하며 다양한 기술에 대한 이해가 필요합니다.

Web.xml 파일을 열려면 다음 방법을 사용할 수 있습니다. 텍스트 편집기 (예 : 메모장 또는 문자 메시지)를 사용하여 통합 개발 환경 (예 : Eclipse 또는 NetBeans)을 사용하여 명령을 편집하십시오 (Windows : Notepad Web.xml; Mac/Linux : Open -A Texted web.xml).

XML 서식 도구는 규칙에 따라 코드를 입력하여 가독성과 이해를 향상시킬 수 있습니다. 도구를 선택할 때는 사용자 정의 기능, 특수 상황 처리, 성능 및 사용 편의성에주의하십시오. 일반적으로 사용되는 도구 유형에는 온라인 도구, IDE 플러그인 및 명령 줄 도구가 포함됩니다.

XML을 PDF로 직접 변환하는 응용 프로그램은 근본적으로 다른 두 형식이므로 찾을 수 없습니다. XML은 데이터를 저장하는 데 사용되는 반면 PDF는 문서를 표시하는 데 사용됩니다. 변환을 완료하려면 Python 및 ReportLab과 같은 프로그래밍 언어 및 라이브러리를 사용하여 XML 데이터를 구문 분석하고 PDF 문서를 생성 할 수 있습니다.

대부분의 텍스트 편집기를 사용하여 XML 파일을여십시오. 보다 직관적 인 트리 디스플레이가 필요한 경우 Oxygen XML 편집기 또는 XMLSPy와 같은 XML 편집기를 사용할 수 있습니다. 프로그램에서 XML 데이터를 처리하는 경우 프로그래밍 언어 (예 : Python) 및 XML 라이브러 (예 : XML.etree.elementtree)를 사용하여 구문 분석해야합니다.

XML 온라인 형식 도구는 지저분한 XML 코드를 읽기 쉬운 형식으로 자동 구성하고 형식을 유지 관리합니다. XML의 구문 트리를 구문 분석하고 서식 규칙을 적용함으로써 이러한 도구는 코드의 구조를 최적화하여 유지 관리 가능성과 팀워크 효율성을 향상시킵니다.
